package com.example.demo.beanPostProcessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;

/**
 * @version : 1.0
 * 撸代码前，多思考一点
 * @author: pengzx
 * @Description:
 * @date: 16:52 2018/5/31
 */
@Component
public class DemoBeanPostProcessor implements BeanPostProcessor {
    @Nullable
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException
    {
        return bean;
    }

    @Nullable
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException
    {
        System.out.println("Bean->" + beanName + '\n' + "created->" + bean.toString());
        return bean;
    }
}
